TARGETS = pthread_barrier pthread_tls
all: $(TARGETS)

CC = gcc
CPP = g++
CCFLAGS = -g
CPPFLAGS = -g

LIBS = -lpthread

%.o:%.c
	$(CC) $(CCFLAGS) -c $< -o $@

%.o:%.cpp
	$(CPP) $(CPPFLAGS) -c $< -o $@

pthread_barrier: pthread_barrier.o
	$(CC) $(CCFLAGS) $^ -o pthread_barrier $(LIBS)

pthread_tls: pthread_tls.o
	$(CPP) $(CPPFLAGS) $^ -o pthread_tls $(LIBS)

.PHONY: clean
clean:
	rm -rf $(TARGETS) *.o